package com.iaiai.imail.core;

import android.content.Context;

import com.iaiai.imail.dao.EmailDao;
import com.iaiai.imail.dao.InboxDao;
import com.iaiai.imail.dao.impl.EmailDaoImpl;
import com.iaiai.imail.dao.impl.InboxDaoImpl;

/**
 * 
 * <p>
 * Title: IServiceFactory.java
 * </p>
 * <p>
 * E-Mail: 176291935@qq.com
 * </p>
 * <p>
 * QQ: 176291935
 * </p>
 * <p>
 * Http: iaiai.iteye.com
 * </p>
 * <p>
 * Create time: 2012-9-12 上午11:03:53
 * </p>
 * 
 * @author 丸子
 * @version 0.0.1
 */
public class IServiceFactory {

	private static IServiceFactory serviceFactory;

	private EmailDao emailDao;
	
	private InboxDao inboxDao;

	/**
	 * 初始化所有dao
	 * 
	 * @param context
	 * @return
	 */
	public static synchronized IServiceFactory getInstance(Context context) {
		if (serviceFactory == null) {
			serviceFactory = new IServiceFactory();
			serviceFactory.setEmailDao(new EmailDaoImpl());
			serviceFactory.setInboxDao(new InboxDaoImpl());
		}
		return serviceFactory;
	}
	
	/**
	 * 获得Service
	 * 
	 * @return
	 */
	public static IServiceFactory getInstance() {
		return serviceFactory;
	}

	/**
	 * @return the emailDao
	 */
	public EmailDao getEmailDao() {
		return emailDao;
	}

	/**
	 * @param emailDao
	 *            the emailDao to set
	 */
	public void setEmailDao(EmailDao emailDao) {
		this.emailDao = emailDao;
	}

	/**
	 * @return the inboxDao
	 */
	public InboxDao getInboxDao() {
		return inboxDao;
	}

	/**
	 * @param inboxDao the inboxDao to set
	 */
	public void setInboxDao(InboxDao inboxDao) {
		this.inboxDao = inboxDao;
	}

}
